#ifndef ZXC_RP_COMMON
#define ZXC_RP_COMMON

float4x4 unity_MatrixV;
float4x4 unity_MatrixVP;
float4 cameraPos;

cbuffer UnityPerDraw
{
    float4x4 unity_ObjectToWorld;
    float4x4 unity_WorldToObject;
    float4 unity_LODFade;
    float4 unity_WorldTransformParams;
}

#define MATRIX_M unity_ObjectToWorld
#define MATRIX_I_M unity_WorldToObject
#define MATRIX_V unity_MatrixV
#define MATRIX_VP unity_MatrixVP

float3 ObjectToWorld(float3 positionOS)
{
    return mul(MATRIX_M, float4(positionOS, 1.0)).xyz;
}

float4 ObjectToHClip(float3 positionOS)
{
    return mul(MATRIX_VP, mul(unity_ObjectToWorld, float4(positionOS, 1.0)));
}

float3 ObjectToWorldNormal(float3 normalOS)
{
    return mul(normalOS, (float3x3)MATRIX_I_M);
}

#endif